//
//  HBPageSegmentView.h
//  HBLibary
//
//  Created by Rambo on 2018/8/20.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, HBPageSegmentViewSelectLineJoinType) {
    HBPageSegmentViewSelectLineJoinTypeMiter,
    HBPageSegmentViewSelectLineJoinTypeRound,
};

typedef void(^HBPageSegmentViewSelectPageBlock)(NSInteger currentPage);

@interface HBPageSegmentView : UIView

/**
 快速创建 HBPageSegmentView
 
 @param titles 标题数组
 @param titleFont 标题字体大小
 @param minMargin 标题之间最小间隙
 @param complete 回调
 @return HBPageSegmentView对象
 */
- (instancetype)initWithTitles:(NSArray<NSString*>*)titles titleFont:(UIFont*)titleFont minMargin:(CGFloat)minMargin complete:(HBPageSegmentViewSelectPageBlock)complete;

/**
 快速创建 HBPageSegmentView
 
 @param titles 标题数组
 @param titleFont 标题字体大小
 @param minMargin 标题之间最小间隙
 @param  tagWidth 标签宽度（为0时代表字体宽度）
 @param complete 回调
 @return HBPageSegmentView对象
 */
- (instancetype)initWithTitles:(NSArray<NSString*>*)titles titleFont:(UIFont*)titleFont minMargin:(CGFloat)minMargin tagWidth:(CGFloat)tagWidth complete:(HBPageSegmentViewSelectPageBlock)complete;

- (void)selectPageWithIndex:(NSInteger)index;

@property (nonatomic, strong) UIColor *selectLineColor;         ///< default red color

@property (nonatomic, strong) UIColor *bottomLineColor;         ///< default lightGray color

@property (nonatomic, assign) CGFloat bottomLineHeight;         ///< default 1.0

@property (nonatomic, assign) CGFloat selectLineHeight;         ///< default 2.0

@property (nonatomic, assign) CGFloat selectLineWidth;         ///< 默认等于字体宽度

@property (nonatomic, assign) HBPageSegmentViewSelectLineJoinType selectLineJoinType;         ///< 选中线头尾类型

@property (nonatomic, assign) CGFloat selectButtonScaleMultiplier;  ///< default 1.2  (value 1.0f ~ 2.0f)

@property (nonatomic, strong) UIColor *titleNormalColor;        ///< default lightGray color

@property (nonatomic, strong) UIColor *titleSelectColor;        ///< default red color

- (void)updateTitle:(NSString*)title atIndex:(NSInteger)index;

- (instancetype)init UNAVAILABLE_ATTRIBUTE;
- (instancetype)initWithFrame:(CGRect)frame UNAVAILABLE_ATTRIBUTE;
+ (instancetype)new UNAVAILABLE_ATTRIBUTE;

@end
